<?php

namespace App\Http\Controllers\Backend;


use App\Manage\UploadManage;

class UploadController extends BaseController
{
    // 一般操作
    public function initialize()
    {
        parent::initialize();
    }


    // 上传文件
    public function local()
    {
        $logic = new UploadManage();
        $opti  = [];
        $src   = $logic->local($this->myUser, $opti);
        if($src === false){
            return $this->error($logic->getError());
        }

        return $this->success(['file'=>$src]);
    }

    // 图片信息（测试）
    public function image()
    {
        $logic = new UploadManage();
        $src   = $logic->image();
        if($src === false){
            return $this->error($logic->getError());
        }


    }

    // 上传七牛云（并压缩图片在上传）
    public function qiniu()
    {
        $opti  = [];
        $logic = new UploadManage();
        $to    = $logic->qiniu($this->myUser, $opti);
        if($to === false){
            return $this->error($logic->getError());
        }

        return $this->success($to);
    }

    // 上传七牛云
    public function qiniu2()
    {
        $logic = new UploadManage();
        $to    = $logic->qiniu();
        if($to === false){
            return $this->error($logic->getError());
        }

        return $this->success($to);
    }


}


